/*
 * Team Java
 * Michael Pogson, Michael Satranjr, Stephen Hunter
 * Project 1
 * 4/26/12
 */
package view;

import java.awt.BorderLayout;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

/**
 * The frame for displaying the results of the web crawling.
 * @author Michael Pogson, Michael Satran Jr, Stephen Hunter
 * @version Spring 2012
 */
public class ResultsFrame {
	
	private final JFrame my_frame;
	
	private final JTextArea my_text_area;
	
	private final JScrollPane my_pane;

	
	/**
	 * Sets up all field appropriately.
	 */
	public ResultsFrame() {
		my_frame = new JFrame("Results");
		my_frame.setLayout(new BorderLayout());
		my_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		my_frame.setLocationRelativeTo(null);
		my_frame.setBounds(100, 100, 450, 300);
		
		my_text_area = new JTextArea();
		
		my_pane = new JScrollPane(my_text_area);
	}
	
	/**
	 * Adds a ContentPane to the frame and makes it visible.
	 */
	public void setUp() {
		my_frame.getContentPane().add(my_pane, BorderLayout.CENTER);
		my_frame.setVisible(true);
		my_frame.setDefaultCloseOperation(my_frame.EXIT_ON_CLOSE);
		
	}
	
	/**
	 * Writes the given String to the text field.
	 * 
	 * @param the_info The String to write to the text field
	 */
	public void write(final String the_info) {
		my_text_area.append(the_info);
	}
}
